package com.dianrui.moonfire.update;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.dianrui.moonfire.R;


/*
 *  @项目名：  SmartWater_Android
 *  @包名：    com.gddxit.smartwater.module.workorder.view
 *  @文件名:   DownloadProssDialog
 *  @创建者:   61594
 *  @创建时间:  2017/5/12 16:38
 *  @描述：下载apk时的进度条
 */
public class DownloadProssDialog extends Dialog {


    private Context context;
    private CircleView circle_progress;
    private TextView tv_progress;
    private TextView tv_update_reamrk;

    public DownloadProssDialog(Context context) {
        super(context);
        init(context);
    }

    public DownloadProssDialog(Context context, int themeResId) {
        super(context, themeResId);
        init(context);
    }

    protected DownloadProssDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        init(context);
    }

    private void init(Context context) {
        this.context = context;
        setCancelable(false); //包含屋里返回键
        setCanceledOnTouchOutside(false);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        View rootView = LayoutInflater.from(context).inflate(R.layout.dialog_download_pross, null);
        tv_progress = rootView.findViewById(R.id.dialog_download_pross_tv_progress);
        tv_update_reamrk = rootView.findViewById(R.id.dialog_download_pross_tv_update_reamrk);
        circle_progress = rootView.findViewById(R.id.dialog_download_pross_circle_progress);
        setContentView(rootView);
    }

    public void setProgress(int progress,String reamrk) {
        tv_progress.setText(progress + "%");
        circle_progress.setProgress(progress);
        tv_update_reamrk.setText(reamrk);
    }


    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);

    }
}
